<?php

if (__FILE__ == '') {

    die('Fatal error code: 0');
}

error_reporting(4);

//open output buffering

ob_start();

//open variable $_SESSION

session_start();

//时区设置

date_default_timezone_set('Asia/Shanghai');

//站点后台功能目录配置

define("LIB_DIR", SYSTEM . "lib/");

define("CLASS_DIR", SYSTEM . "lib/class/");

define("FUN_DIR", SYSTEM . "lib/function/");

//服务器设置

@ini_set('memory_limit', '128M');

@ini_set('session.cache_expire', 180);

@ini_set('session.use_trans_sid', 0);

@ini_set('session.use_cookies', 1);

@ini_set('session.auto_start', 0);

@ini_set('display_errors', 1);

//关键参数
define("Q", str_ireplace(array('index.php', 'Index.php'), '', $_SERVER['SCRIPT_NAME']) . '?q=');

//加载必须函数库

require_once(FUN_DIR . "functions.php");

//防注入

if (!get_magic_quotes_gpc()) {

    if (!empty($_GET)) {

        $_GET = addslashes_deep($_GET);
    }

    if (!empty($_POST)) {

        $_POST = addslashes_deep($_POST);
    }

    if (!empty($_COOKIE)) {

        $_COOKIE = addslashes_deep($_COOKIE);
    }

    if (!empty($_REQUEST)) {

        $_REQUEST = addslashes_deep($_REQUEST);
    }
}



//去除POST值首尾空格及换行符

array_trim($_POST, true);

//加载核心类库

try {

    //核心方法库

    require_once(FUN_DIR . "function.core.php");

    function __autoload($className) {

        if (file_exists(CLASS_DIR . $className . ".class.php")) {
            $className = ucwords($className);
            @include_once(CLASS_DIR . $className . ".class.php");
        } else {
            @include_once($className . '.php');
        }
    }

    @spl_autoload_register("__autoload");
} catch (Exception $e) {

    throw_exception($e->getMessage());
}